package com.crealth.mapper;


import java.sql.Timestamp;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.crealth.model.UserModel;

public abstract interface UserMapper {
	
    public abstract UserModel selectUserByLoginName(
    		@Param("loginName")String loginName);
    
    public abstract void updateUserByUserID(UserModel userModel);
    
    public abstract UserModel selectUserByName(
    		@Param("userName")String userName);
    
    public abstract UserModel selectUserByID(
    		@Param("userID")int userID);
    
    public abstract List<Integer> selectUnderlingIDs(
    		@Param("userID")int userID);
    
    public abstract List<Integer> selectBranchUserIDs(
    		@Param("companyID")int companyID);
    
    public abstract List<Integer> selectAllSalesManIDs();
    public abstract List<Integer> selectAllSalesManAndTeamMgrIDs();
    public abstract List<Integer> selectAllOnjobSalesManIDs();
    
    public abstract List<Integer> selectAdminIDs();
    
    public abstract List<UserModel> selectUnderling(
    		@Param("userID")int userID);
    public abstract List<UserModel> selectGroupUsers(
    		@Param("groupMgr")String groupMgr);
    
    public abstract List<UserModel> selectBranchUser(
    		@Param("companyID")int companyID);
    
    public abstract List<UserModel> selectCompanyAndDepartmentUser(
    		@Param("companyIDs")String companyIDs,
    		@Param("topCompanyID")int topCompanyID);
    
    //  获取 公司  指定职位的用户
    public abstract List<UserModel> selectCompanyPositionUser(
    		@Param("companyID")int companyID,
    		@Param("posi")int posi);
    
    //  获取 公司 高管   副总级别以上
    public abstract List<UserModel> selectCompanyTopManager();
    
    
    public abstract Integer selectUserPosition(
    		@Param("userID")int userID);
    
    public abstract Integer selectLeaderID(
    		@Param("userID")int userID);
    
    public abstract List<UserModel> selectAllUser();
    
    public abstract List<UserModel> selectAllOnJobUser();
    
    //  或者 制定职位的员工  比如 客服
    public abstract List<UserModel> selectCompanyUsersByPosition(
    		@Param("pos")int pos);
    
    public abstract List<Integer> selectUserIDsByPosition(
    		@Param("pos")int pos);
    
    public abstract List<UserModel> selectTeamUserByTeamID(
    		@Param("teamID")int teamID);
    
    public abstract void insertStaff(UserModel userModel);
    
    public abstract void updateUserOnline(
    		@Param("userID")int userID,
    		@Param("setOnline")int setOnline);
    
    // 查询 业务经理
    public abstract List<UserModel> selectSalesManager();
    
    // 将所有在线用户标记为不在线
    public abstract void cleanOnlineUser();
    //  查询  上次到了 客户表的 ID
    public abstract Integer selectMarkClientPreID(
    		@Param("userID")int userID);
    // 更新  客户表的ID
    public abstract void updateMarkClientPreID(
    		@Param("userID")int userID,
    		@Param("setPreID")int setPreID);
    
    //  修改登录密码
    public abstract void updateUserLoginPwd(
    		@Param("userID")int userID,
    		@Param("setNewPwd")String setNewPwd);
    
    public abstract void updateSipAccountByID(
    		@Param("userID")int userID,
    		@Param("sipServerIP")String sipServerIP,
    		@Param("sipAct")String sipAct,
    		@Param("sipPwd")String sipPwd,
    		@Param("incomingServerIP")String incomingServerIP,
    		@Param("incomingSipAct")String incomingSipAct,
    		@Param("incomingSipPwd")String incomingSipPwd);
    
    public abstract Integer updateUserMOBByID(
    		@Param("userID")int userID,
    		@Param("setMOB")int setMOB);
    
    public abstract Integer updateTeamUserLeaderByTeamID(
    		@Param("teamID")int teamID,
    		@Param("leaderID")int leaderID);
    
    public abstract Integer updateTeamLeaderByID(
    		@Param("userID")int userID,
    		@Param("leaderID")int leaderID);
    
    //  获取最新客户端的版本号
    public abstract String selectClientVersion();
    
    //  是否 显示客户信息
    public abstract Integer selectIsShowConsumerInfo();
    public abstract Integer updateIsShowConsumerInfo(
    		@Param("setValue")int setValue);
    // SIP 分派模式
    public abstract Integer selectSipDispatchType();
    public abstract Integer updateSipDispatchType(
    		@Param("setValue")int setValue);
    
    public abstract Integer selectGroupCallType();
    public abstract Integer updateGroupCallType(
    		@Param("setValue")int setValue);
    
    public abstract Timestamp selectUploadGroupCallTm();
    
    public abstract Integer updateSql(@Param("updateSql")String updateSql);
    
    public abstract Integer updateUserMacAddr(
    		@Param("userID")int userID, 
    		@Param("macAddr")String macAddr);
    
    public abstract Integer updateUserLastLoginMacAddr(
    		@Param("userID")int userID, 
    		@Param("macAddr")String macAddr);
    
    public abstract Integer updateUserLoginMacAddrToMac(
    		@Param("userID")int userID);
    
    public abstract Integer updateEntryFile(
    		@Param("userID")int userID,
    		@Param("setEntryFile")String setEntryFile,
    		@Param("setEntryFileUrl")String setEntryFileUrl);    
    public abstract Integer updatePictureFile(
    		@Param("userID")int userID,
    		@Param("setPictureFile")String setPictureFile,
    		@Param("setPictureFileUrl")String setPictureFileUrl);
    public abstract Integer updateIdentityFile(
    		@Param("userID")int userID,
    		@Param("setIdentityFile")String setIdentityFile,
    		@Param("setIdentityFileUrl")String setIdentityFileUrl);
    public abstract Integer updateBankFile(
    		@Param("userID")int userID,
    		@Param("setBankFile")String setBankFile,
    		@Param("setBankFileUrl")String setBankFileUrl);
    public abstract Integer updateOtherFile(
    		@Param("userID")int userID,
    		@Param("setOtherFile")String setOtherFile,
    		@Param("setOtherFileUrl")String setOtherFileUrl);
    
    public abstract Integer updateCompanyIDByTeamID(
    		@Param("teamID")int teamID,
    		@Param("companyID")int companyID );
    
    
}
